﻿namespace EFS.Common.UI.Extensions
{
	public static class DataGrid
	{
		public static System.Int32 GetRowCount(
			this System.Windows.Controls.DataGrid dataGrid)
		{
			// count
			System.Int32 count = 0;

			// only if exists
			if (null != dataGrid.ItemsSource)
			{
				// cicle all
				foreach (System.Object data in dataGrid.ItemsSource)
				{
					++count;
				}
			}

			// ok
			return count;
		}
	}

}